﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using MiniFox.Data.EntityFramework;
using MiniFox.Data.EntityFramework.MySql;

namespace Platform.Data.Entities.MySql;

public partial class PlatformDbContext : MySqlDbContext
{
    public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
        : base("PlatformDbContext", options)
    {
    }

    public virtual DbSet<DingtalkSent> DingtalkSent { get; set; }

    public virtual DbSet<DsConnection> DsConnection { get; set; }

    public virtual DbSet<DtExcelExport> DtExcelExport { get; set; }

    public virtual DbSet<DtExcelImport> DtExcelImport { get; set; }

    public virtual DbSet<File> File { get; set; }

    public virtual DbSet<Folder> Folder { get; set; }

    public virtual DbSet<MailSent> MailSent { get; set; }

    public virtual DbSet<MailSentFail> MailSentFail { get; set; }

    public virtual DbSet<MessageAttachment> MessageAttachment { get; set; }

    public virtual DbSet<MessageRecv> MessageRecv { get; set; }

    public virtual DbSet<MessageSent> MessageSent { get; set; }

    public virtual DbSet<PublishLog> PublishLog { get; set; }

    public virtual DbSet<RepositorySet> RepositorySet { get; set; }

    public virtual DbSet<SequenceSet> SequenceSet { get; set; }

    public virtual DbSet<SysApp> SysApp { get; set; }

    public virtual DbSet<SysAppSecret> SysAppSecret { get; set; }

    public virtual DbSet<SysAuthCode> SysAuthCode { get; set; }

    public virtual DbSet<SysAuthToken> SysAuthToken { get; set; }

    public virtual DbSet<SysDept> SysDept { get; set; }

    public virtual DbSet<SysDeviceAuth> SysDeviceAuth { get; set; }

    public virtual DbSet<SysDict> SysDict { get; set; }

    public virtual DbSet<SysDictItem> SysDictItem { get; set; }

    public virtual DbSet<SysEnvConfig> SysEnvConfig { get; set; }

    public virtual DbSet<SysJwtToken> SysJwtToken { get; set; }

    public virtual DbSet<SysMenu> SysMenu { get; set; }

    public virtual DbSet<SysMenuLink> SysMenuLink { get; set; }

    public virtual DbSet<SysMenuModule> SysMenuModule { get; set; }

    public virtual DbSet<SysModule> SysModule { get; set; }

    public virtual DbSet<SysModuleAction> SysModuleAction { get; set; }

    public virtual DbSet<SysNav> SysNav { get; set; }

    public virtual DbSet<SysNavLink> SysNavLink { get; set; }

    public virtual DbSet<SysNavModule> SysNavModule { get; set; }

    public virtual DbSet<SysOpenAuthUser> SysOpenAuthUser { get; set; }

    public virtual DbSet<SysOrganization> SysOrganization { get; set; }

    public virtual DbSet<SysPassportToken> SysPassportToken { get; set; }

    public virtual DbSet<SysPassword> SysPassword { get; set; }

    public virtual DbSet<SysPincode> SysPincode { get; set; }

    public virtual DbSet<SysRole> SysRole { get; set; }

    public virtual DbSet<SysRoleModule> SysRoleModule { get; set; }

    public virtual DbSet<SysRoleModuleAction> SysRoleModuleAction { get; set; }

    public virtual DbSet<SysSignLog> SysSignLog { get; set; }

    public virtual DbSet<SysTicket> SysTicket { get; set; }

    public virtual DbSet<SysUser> SysUser { get; set; }

    public virtual DbSet<SysUserConfig> SysUserConfig { get; set; }

    public virtual DbSet<SysUserDept> SysUserDept { get; set; }

    public virtual DbSet<SysUserRole> SysUserRole { get; set; }

    public virtual DbSet<SysUserShortcut> SysUserShortcut { get; set; }

    public virtual DbSet<SysUserTicket> SysUserTicket { get; set; }

    public virtual DbSet<UserWidget> UserWidget { get; set; }

    public virtual DbSet<VersionItem> VersionItem { get; set; }

    public virtual DbSet<VersionSet> VersionSet { get; set; }

    public virtual DbSet<WechatSent> WechatSent { get; set; }

    public virtual DbSet<WorkItem> WorkItem { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder
            .UseCollation("utf8mb4_0900_ai_ci")
            .HasCharSet("utf8mb4");

        modelBuilder.Entity<DingtalkSent>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("dingtalk_sent");

            entity.Property(e => e.MessageId)
                .HasMaxLength(50)
                .HasColumnName("message_id");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .HasColumnName("account_name");
            entity.Property(e => e.Body).HasColumnName("body");
            entity.Property(e => e.Data).HasColumnName("data");
            entity.Property(e => e.PictureUrl)
                .HasMaxLength(2048)
                .HasColumnName("picture_url");
            entity.Property(e => e.Receiver)
                .HasMaxLength(500)
                .HasColumnName("receiver");
            entity.Property(e => e.Response).HasColumnName("response");
            entity.Property(e => e.Result).HasColumnName("result");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("send_time");
            entity.Property(e => e.TaskId)
                .HasMaxLength(50)
                .HasColumnName("task_id");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .HasColumnName("template_name");
            entity.Property(e => e.Title)
                .HasMaxLength(100)
                .HasColumnName("title");
            entity.Property(e => e.Url)
                .HasMaxLength(2048)
                .HasColumnName("url");
        });

        modelBuilder.Entity<DsConnection>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PRIMARY");

            entity.ToTable("ds_connection");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.ConnectionString)
                .HasMaxLength(1024)
                .HasColumnName("connection_string");
            entity.Property(e => e.ProviderName)
                .HasMaxLength(50)
                .HasColumnName("provider_name");
        });

        modelBuilder.Entity<DtExcelExport>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PRIMARY");

            entity.ToTable("dt_excel_export");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.DataLoader)
                .HasMaxLength(100)
                .HasColumnName("data_loader");
            entity.Property(e => e.ExcelFormat)
                .HasMaxLength(100)
                .HasDefaultValueSql("'XLS'")
                .HasColumnName("excel_format");
            entity.Property(e => e.MaxRowCountPerSheet)
                .HasDefaultValueSql("'65535'")
                .HasColumnName("max_row_count_per_sheet");
            entity.Property(e => e.Modules)
                .HasColumnType("json")
                .HasColumnName("modules");
            entity.Property(e => e.Sheets)
                .HasColumnType("json")
                .HasColumnName("sheets");
            entity.Property(e => e.Template)
                .HasMaxLength(500)
                .HasColumnName("template");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<DtExcelImport>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PRIMARY");

            entity.ToTable("dt_excel_import");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.DataWriter)
                .HasMaxLength(100)
                .HasColumnName("data_writer");
            entity.Property(e => e.MaxImportFileSize)
                .HasDefaultValueSql("'104857600'")
                .HasColumnName("max_import_file_size");
            entity.Property(e => e.Modules)
                .HasColumnType("json")
                .HasColumnName("modules");
            entity.Property(e => e.PreImport).HasColumnName("pre_import");
            entity.Property(e => e.Sheets)
                .HasColumnType("json")
                .HasColumnName("sheets");
            entity.Property(e => e.Template)
                .HasMaxLength(500)
                .HasColumnName("template");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<File>(entity =>
        {
            entity.HasKey(e => e.FileId).HasName("PRIMARY");

            entity.ToTable("file");

            entity.HasIndex(e => new { e.Group, e.Path, e.FileName }, "file_uk").IsUnique();

            entity.Property(e => e.FileId)
                .HasMaxLength(50)
                .HasColumnName("file_id");
            entity.Property(e => e.Accepted).HasColumnName("accepted");
            entity.Property(e => e.ContentLength).HasColumnName("content_length");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ExtName)
                .HasMaxLength(10)
                .HasColumnName("ext_name");
            entity.Property(e => e.FileName)
                .HasMaxLength(50)
                .HasColumnName("file_name");
            entity.Property(e => e.Group)
                .HasMaxLength(50)
                .HasColumnName("group");
            entity.Property(e => e.MimeType)
                .HasMaxLength(200)
                .HasColumnName("mime_type");
            entity.Property(e => e.Path)
                .HasMaxLength(512)
                .HasDefaultValueSql("'/'")
                .HasComment("目录路径")
                .HasColumnName("path");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<Folder>(entity =>
        {
            entity.HasKey(e => e.FolderId).HasName("PRIMARY");

            entity.ToTable("folder");

            entity.HasIndex(e => new { e.Group, e.Path }, "folder_uk").IsUnique();

            entity.Property(e => e.FolderId)
                .HasMaxLength(50)
                .HasColumnName("folder_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.FolderName)
                .HasMaxLength(50)
                .HasColumnName("folder_name");
            entity.Property(e => e.Group)
                .HasMaxLength(50)
                .HasColumnName("group");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
            entity.Property(e => e.Path)
                .HasMaxLength(512)
                .HasColumnName("path");
            entity.Property(e => e.SuperId)
                .HasMaxLength(50)
                .HasColumnName("super_id");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<MailSent>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("mail_sent");

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .HasColumnName("message_id");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .HasColumnName("account_name");
            entity.Property(e => e.BccList)
                .HasMaxLength(1024)
                .HasColumnName("bcc_list");
            entity.Property(e => e.Body)
                .HasColumnType("text")
                .HasColumnName("body");
            entity.Property(e => e.CcList)
                .HasMaxLength(1024)
                .HasColumnName("cc_list");
            entity.Property(e => e.IsAsync).HasColumnName("is_async");
            entity.Property(e => e.Receiver)
                .HasMaxLength(200)
                .HasColumnName("receiver");
            entity.Property(e => e.SendData)
                .HasColumnType("text")
                .HasColumnName("send_data");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("send_time");
            entity.Property(e => e.Sender)
                .HasMaxLength(100)
                .HasColumnName("sender");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .HasColumnName("template_name");
            entity.Property(e => e.Title)
                .HasMaxLength(50)
                .HasColumnName("title");
        });

        modelBuilder.Entity<MailSentFail>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("mail_sent_fail");

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .HasColumnName("message_id");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .HasColumnName("account_name");
            entity.Property(e => e.BccList)
                .HasMaxLength(1024)
                .HasColumnName("bcc_list");
            entity.Property(e => e.Body)
                .HasColumnType("text")
                .HasColumnName("body");
            entity.Property(e => e.CcList)
                .HasMaxLength(1024)
                .HasColumnName("cc_list");
            entity.Property(e => e.Exception)
                .HasColumnType("text")
                .HasColumnName("exception");
            entity.Property(e => e.IsAsync).HasColumnName("is_async");
            entity.Property(e => e.Receiver)
                .HasMaxLength(200)
                .HasColumnName("receiver");
            entity.Property(e => e.SendData)
                .HasColumnType("text")
                .HasColumnName("send_data");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("send_time");
            entity.Property(e => e.Sender)
                .HasMaxLength(100)
                .HasColumnName("sender");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .HasColumnName("template_name");
            entity.Property(e => e.Title)
                .HasMaxLength(50)
                .HasColumnName("title");
        });

        modelBuilder.Entity<MessageAttachment>(entity =>
        {
            entity.HasKey(e => e.FileId).HasName("PRIMARY");

            entity.ToTable("message_attachment");

            entity.Property(e => e.FileId)
                .HasMaxLength(50)
                .HasColumnName("file_id");
            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .HasColumnName("message_id");
        });

        modelBuilder.Entity<MessageRecv>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("message_recv");

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .HasColumnName("message_id");
            entity.Property(e => e.Body).HasColumnName("body");
            entity.Property(e => e.GroupName)
                .HasMaxLength(50)
                .HasColumnName("group_name");
            entity.Property(e => e.HasRead).HasColumnName("has_read");
            entity.Property(e => e.OwnerId)
                .HasMaxLength(50)
                .HasColumnName("owner_id");
            entity.Property(e => e.ReceiveTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("receive_time");
            entity.Property(e => e.SenderId)
                .HasMaxLength(50)
                .HasColumnName("sender_id");
            entity.Property(e => e.SenderName)
                .HasMaxLength(50)
                .HasColumnName("sender_name");
            entity.Property(e => e.Title)
                .HasMaxLength(100)
                .HasColumnName("title");
        });

        modelBuilder.Entity<MessageSent>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("message_sent");

            entity.Property(e => e.MessageId)
                .HasMaxLength(64)
                .HasColumnName("message_id");
            entity.Property(e => e.Body).HasColumnName("body");
            entity.Property(e => e.Data).HasColumnName("data");
            entity.Property(e => e.GroupName)
                .HasMaxLength(50)
                .HasColumnName("group_name");
            entity.Property(e => e.ReceiverId)
                .HasMaxLength(50)
                .HasColumnName("receiver_id");
            entity.Property(e => e.ReceiverName)
                .HasMaxLength(50)
                .HasColumnName("receiver_name");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("send_time");
            entity.Property(e => e.SenderId)
                .HasMaxLength(50)
                .HasColumnName("sender_id");
            entity.Property(e => e.SenderName)
                .HasMaxLength(50)
                .HasColumnName("sender_name");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .HasColumnName("template_name");
            entity.Property(e => e.Title)
                .HasMaxLength(50)
                .HasColumnName("title");
        });

        modelBuilder.Entity<PublishLog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PRIMARY");

            entity.ToTable("publish_log");

            entity.HasIndex(e => e.VersionId, "publish_log_version_item_FK");

            entity.Property(e => e.Id)
                .HasMaxLength(50)
                .HasColumnName("id");
            entity.Property(e => e.PublishTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("publish_time");
            entity.Property(e => e.PublisherId)
                .HasMaxLength(64)
                .HasColumnName("publisher_id");
            entity.Property(e => e.PublisherName)
                .HasMaxLength(100)
                .HasColumnName("publisher_name");
            entity.Property(e => e.VersionId).HasColumnName("version_id");
        });

        modelBuilder.Entity<RepositorySet>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PRIMARY");

            entity.ToTable("repository_set");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.Description)
                .HasMaxLength(1000)
                .HasColumnName("description");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SequenceSet>(entity =>
        {
            entity.HasKey(e => e.Name).HasName("PRIMARY");

            entity.ToTable("sequence_set");

            entity.HasIndex(e => e.Prefix, "sequence_set_unique").IsUnique();

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.BaseOnUtc).HasColumnName("base_on_utc");
            entity.Property(e => e.CurrentVal).HasColumnName("current_val");
            entity.Property(e => e.Description)
                .HasMaxLength(1000)
                .HasComment("描述")
                .HasColumnName("description");
            entity.Property(e => e.Length)
                .HasDefaultValueSql("'4'")
                .HasColumnName("length");
            entity.Property(e => e.MaxVal)
                .HasDefaultValueSql("'9999'")
                .HasColumnName("max_val");
            entity.Property(e => e.Pattern)
                .HasMaxLength(20)
                .HasDefaultValueSql("'yyyyMMdd'")
                .HasColumnName("pattern");
            entity.Property(e => e.Prefix)
                .HasMaxLength(5)
                .HasColumnName("prefix");
            entity.Property(e => e.Suffix)
                .HasMaxLength(5)
                .HasColumnName("suffix");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysApp>(entity =>
        {
            entity.HasKey(e => e.AppId).HasName("PRIMARY");

            entity.ToTable("sys_app");

            entity.HasIndex(e => e.AppName, "sys_app_uk").IsUnique();

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasComment("应用id")
                .HasColumnName("app_id");
            entity.Property(e => e.AppName)
                .HasMaxLength(50)
                .HasComment("应用名")
                .HasColumnName("app_name");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Enabled).HasColumnName("enabled");
            entity.Property(e => e.Host)
                .HasMaxLength(50)
                .HasComment("主机")
                .HasColumnName("host");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasComment("应用图标")
                .HasColumnName("icon");
            entity.Property(e => e.Path)
                .HasMaxLength(100)
                .HasComment("主路径")
                .HasColumnName("path");
            entity.Property(e => e.Port)
                .HasMaxLength(5)
                .HasComment("端口")
                .HasColumnName("port");
            entity.Property(e => e.Ssl)
                .HasComment("是否为ssl协议")
                .HasColumnName("ssl");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysAppSecret>(entity =>
        {
            entity.HasKey(e => e.AppId).HasName("PRIMARY");

            entity.ToTable("sys_app_secret");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.SecretKey)
                .HasMaxLength(128)
                .HasColumnName("secret_key");
            entity.Property(e => e.SignatureKey)
                .HasMaxLength(16)
                .HasColumnName("signature_key");
        });

        modelBuilder.Entity<SysAuthCode>(entity =>
        {
            entity.HasKey(e => new { e.TicketId, e.AppId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_auth_code");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.Code)
                .HasMaxLength(512)
                .HasColumnName("code");
            entity.Property(e => e.Context)
                .HasMaxLength(256)
                .HasColumnName("context");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.Scope)
                .HasMaxLength(20)
                .HasColumnName("scope");
        });

        modelBuilder.Entity<SysAuthToken>(entity =>
        {
            entity.HasKey(e => new { e.TicketId, e.AppId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_auth_token");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.AccessExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("access_expire_time");
            entity.Property(e => e.AccessToken)
                .HasMaxLength(512)
                .HasColumnName("access_token");
            entity.Property(e => e.Context)
                .HasMaxLength(256)
                .HasColumnName("context");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.RenewExpireTime)
                .HasComment("刷新令牌的过期时间")
                .HasColumnType("timestamp")
                .HasColumnName("renew_expire_time");
            entity.Property(e => e.RenewTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasComment("最近一次刷新时间")
                .HasColumnType("timestamp")
                .HasColumnName("renew_time");
            entity.Property(e => e.RenewToken)
                .HasMaxLength(512)
                .HasColumnName("renew_token");
            entity.Property(e => e.Scope)
                .HasMaxLength(20)
                .HasColumnName("scope");
        });

        modelBuilder.Entity<SysDept>(entity =>
        {
            entity.HasKey(e => new { e.OrgId, e.DeptId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_dept");

            entity.HasIndex(e => e.OrgId, "sys_dept_organization_FK");

            entity.HasIndex(e => e.DeptPath, "sys_dept_uk").IsUnique();

            entity.Property(e => e.OrgId)
                .HasMaxLength(64)
                .HasComment("所属机构id")
                .HasColumnName("org_id");
            entity.Property(e => e.DeptId)
                .HasMaxLength(64)
                .HasComment("部门id")
                .HasColumnName("dept_id");
            entity.Property(e => e.DeptName)
                .HasMaxLength(100)
                .HasComment("部门名称")
                .HasColumnName("dept_name");
            entity.Property(e => e.DeptPath)
                .HasMaxLength(512)
                .HasComment("树节点导航路径")
                .HasColumnName("dept_path");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("部门描述")
                .HasColumnName("description");
            entity.Property(e => e.Director)
                .HasMaxLength(64)
                .HasComment("部门负责人")
                .HasColumnName("director");
            entity.Property(e => e.Enabled).HasColumnName("enabled");
            entity.Property(e => e.Ordinal)
                .HasDefaultValueSql("'0'")
                .HasComment("排序字段")
                .HasColumnName("ordinal");
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .HasComment("上级部门id")
                .HasColumnName("parent_id");
        });

        modelBuilder.Entity<SysDeviceAuth>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_device_auth");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.AuthName)
                .HasMaxLength(50)
                .HasColumnName("auth_name");
            entity.Property(e => e.Authorized).HasColumnName("authorized");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.OpenId)
                .HasMaxLength(128)
                .HasColumnName("open_id");
        });

        modelBuilder.Entity<SysDict>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.GroupId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_dict");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.GroupId)
                .HasMaxLength(50)
                .HasColumnName("group_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Description)
                .HasMaxLength(1000)
                .HasColumnName("description");
            entity.Property(e => e.GroupName)
                .HasMaxLength(100)
                .HasColumnName("group_name");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysDictItem>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.GroupId, e.Value })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 });

            entity.ToTable("sys_dict_item");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.GroupId)
                .HasMaxLength(50)
                .HasColumnName("group_id");
            entity.Property(e => e.Value)
                .HasMaxLength(50)
                .HasColumnName("value");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasColumnName("description");
            entity.Property(e => e.Enabled).HasColumnName("enabled");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
            entity.Property(e => e.Text)
                .HasMaxLength(100)
                .HasColumnName("text");
        });

        modelBuilder.Entity<SysEnvConfig>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PRIMARY");

            entity.ToTable("sys_env_config");

            entity.Property(e => e.Id).HasColumnName("id");
            entity.Property(e => e.ConfigData)
                .HasColumnType("json")
                .HasColumnName("config_data");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysJwtToken>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_jwt_token");

            entity.HasIndex(e => e.AppId, "sys_jwt_token_FK");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.Algorithm)
                .HasMaxLength(20)
                .HasColumnName("algorithm");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Duration).HasColumnName("duration");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.Issuer)
                .HasMaxLength(32)
                .HasColumnName("issuer");
            entity.Property(e => e.Signature)
                .HasMaxLength(512)
                .HasColumnName("signature");
            entity.Property(e => e.Subscriber)
                .HasMaxLength(32)
                .HasColumnName("subscriber");
            entity.Property(e => e.TokenType)
                .HasMaxLength(20)
                .HasColumnName("token_type");
        });

        modelBuilder.Entity<SysMenu>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.MenuId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_menu");

            entity.HasIndex(e => e.AppId, "sys_menu_FK");

            entity.HasIndex(e => e.MenuPath, "sys_menu_uk").IsUnique();

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasComment("所属应用ID")
                .HasColumnName("app_id");
            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .HasComment("菜单id")
                .HasColumnName("menu_id");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasComment("菜单图标")
                .HasColumnName("icon");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasComment("标签")
                .HasColumnName("label");
            entity.Property(e => e.MenuName)
                .HasMaxLength(50)
                .HasComment("菜单名")
                .HasColumnName("menu_name");
            entity.Property(e => e.MenuPath)
                .HasMaxLength(512)
                .HasComment("树型导航路径")
                .HasColumnName("menu_path");
            entity.Property(e => e.Ordinal)
                .HasComment("排序字段")
                .HasColumnName("ordinal");
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .HasComment("父级菜单id")
                .HasColumnName("parent_id");
        });

        modelBuilder.Entity<SysMenuLink>(entity =>
        {
            entity.HasKey(e => e.LinkId).HasName("PRIMARY");

            entity.ToTable("sys_menu_link");

            entity.HasIndex(e => new { e.AppId, e.MenuId }, "sys_menu_link_FK");

            entity.Property(e => e.LinkId)
                .HasMaxLength(64)
                .HasColumnName("link_id");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasColumnName("icon");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasColumnName("label");
            entity.Property(e => e.LinkName)
                .HasMaxLength(30)
                .HasColumnName("link_name");
            entity.Property(e => e.LinkUri)
                .HasMaxLength(500)
                .HasColumnName("link_uri");
            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .HasColumnName("menu_id");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .HasColumnName("open_mode");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<SysMenuModule>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.MenuId, e.ModuleId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 });

            entity.ToTable("sys_menu_module");

            entity.HasIndex(e => new { e.AppId, e.MenuId }, "sys_mm_menu_FK");

            entity.HasIndex(e => e.ModuleId, "sys_mm_module_FK");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.MenuId)
                .HasMaxLength(64)
                .HasColumnName("menu_id");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasColumnName("label");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<SysModule>(entity =>
        {
            entity.HasKey(e => e.ModuleId).HasName("PRIMARY");

            entity.ToTable("sys_module");

            entity.HasIndex(e => e.AppId, "sys_module_FK");

            entity.HasIndex(e => new { e.AppId, e.ModuleName }, "sys_module_uk").IsUnique();

            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasComment("模块id")
                .HasColumnName("module_id");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasComment("所属应用")
                .HasColumnName("app_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Enabled)
                .HasComment("是否启用")
                .HasColumnName("enabled");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasComment("模块图标")
                .HasColumnName("icon");
            entity.Property(e => e.IsPublic)
                .HasComment("是否为公共模块(公共模块无需鉴权)")
                .HasColumnName("is_public");
            entity.Property(e => e.ModuleName)
                .HasMaxLength(50)
                .HasComment("模块名称")
                .HasColumnName("module_name");
            entity.Property(e => e.ModuleUri)
                .HasMaxLength(500)
                .HasComment("模块路径(相对路径)")
                .HasColumnName("module_uri");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .HasComment("打开模式")
                .HasColumnName("open_mode");
            entity.Property(e => e.QueryString)
                .HasMaxLength(500)
                .HasComment("静态参数")
                .HasColumnName("query_string");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysModuleAction>(entity =>
        {
            entity.HasKey(e => e.ActionId).HasName("PRIMARY");

            entity.ToTable("sys_module_action");

            entity.HasIndex(e => e.ModuleId, "sys_module_action_sys_module_FK");

            entity.Property(e => e.ActionId)
                .HasMaxLength(64)
                .HasColumnName("action_id");
            entity.Property(e => e.ActionName)
                .HasMaxLength(50)
                .HasColumnName("action_name");
            entity.Property(e => e.ActionUri)
                .HasMaxLength(200)
                .HasColumnName("action_uri");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysNav>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.NavId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_nav");

            entity.HasIndex(e => e.AppId, "sys_nav_FK");

            entity.HasIndex(e => new { e.AppId, e.ParentId, e.NavName }, "sys_nav_uk").IsUnique();

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.NavId)
                .HasMaxLength(64)
                .HasColumnName("nav_id");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasColumnName("icon");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasColumnName("label");
            entity.Property(e => e.NavName)
                .HasMaxLength(50)
                .HasColumnName("nav_name");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
            entity.Property(e => e.ParentId)
                .HasMaxLength(64)
                .HasColumnName("parent_id");
        });

        modelBuilder.Entity<SysNavLink>(entity =>
        {
            entity.HasKey(e => e.LinkId).HasName("PRIMARY");

            entity.ToTable("sys_nav_link");

            entity.HasIndex(e => new { e.AppId, e.NavId }, "sys_menu_link_FK");

            entity.Property(e => e.LinkId)
                .HasMaxLength(64)
                .HasColumnName("link_id");
            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.Icon)
                .HasMaxLength(200)
                .HasColumnName("icon");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasColumnName("label");
            entity.Property(e => e.LinkName)
                .HasMaxLength(30)
                .HasColumnName("link_name");
            entity.Property(e => e.LinkUri)
                .HasMaxLength(500)
                .HasColumnName("link_uri");
            entity.Property(e => e.NavId)
                .HasMaxLength(64)
                .HasColumnName("nav_id");
            entity.Property(e => e.OpenMode)
                .HasMaxLength(20)
                .HasColumnName("open_mode");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<SysNavModule>(entity =>
        {
            entity.HasKey(e => new { e.AppId, e.NavId, e.ModuleId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 });

            entity.ToTable("sys_nav_module");

            entity.HasIndex(e => e.ModuleId, "sys_nav_module_module_FK");

            entity.Property(e => e.AppId)
                .HasMaxLength(64)
                .HasColumnName("app_id");
            entity.Property(e => e.NavId)
                .HasMaxLength(64)
                .HasColumnName("nav_id");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
            entity.Property(e => e.Label)
                .HasMaxLength(20)
                .HasColumnName("label");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<SysOpenAuthUser>(entity =>
        {
            entity.HasKey(e => new { e.OpenId, e.AuthName })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_open_auth_user");

            entity.Property(e => e.OpenId)
                .HasMaxLength(128)
                .HasColumnName("open_id");
            entity.Property(e => e.AuthName)
                .HasMaxLength(50)
                .HasColumnName("auth_name");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.UserData)
                .HasColumnType("json")
                .HasColumnName("user_data");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<SysOrganization>(entity =>
        {
            entity.HasKey(e => e.OrgId).HasName("PRIMARY");

            entity.ToTable("sys_organization");

            entity.HasIndex(e => e.OrgName, "sys_organization_uk").IsUnique();

            entity.Property(e => e.OrgId)
                .HasMaxLength(64)
                .HasComment("机构id")
                .HasColumnName("org_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("描述")
                .HasColumnName("description");
            entity.Property(e => e.DisplayName)
                .HasMaxLength(100)
                .HasComment("显示名称")
                .HasColumnName("display_name");
            entity.Property(e => e.Icon)
                .HasMaxLength(100)
                .HasComment("图标")
                .HasColumnName("icon");
            entity.Property(e => e.Logo)
                .HasMaxLength(100)
                .HasComment("商标")
                .HasColumnName("logo");
            entity.Property(e => e.OrgName)
                .HasMaxLength(100)
                .HasComment("机构名")
                .HasColumnName("org_name");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysPassportToken>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_passport_token");

            entity.HasIndex(e => e.UserId, "sys_passport_token_FK");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.ClientIp)
                .HasMaxLength(50)
                .HasColumnName("client_ip");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity.Property(e => e.Duration).HasColumnName("duration");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.RenewTime)
                .HasColumnType("timestamp")
                .HasColumnName("renew_time");
            entity.Property(e => e.UserAgent)
                .HasMaxLength(500)
                .HasColumnName("user_agent");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<SysPassword>(entity =>
        {
            entity.HasKey(e => e.UserId).HasName("PRIMARY");

            entity.ToTable("sys_password");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.Password)
                .HasMaxLength(128)
                .HasColumnName("password");
        });

        modelBuilder.Entity<SysPincode>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_pincode");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.Code)
                .HasMaxLength(20)
                .HasColumnName("code");
            entity.Property(e => e.CreateTime)
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.SignName)
                .HasMaxLength(50)
                .HasColumnName("sign_name");
        });

        modelBuilder.Entity<SysRole>(entity =>
        {
            entity.HasKey(e => e.RoleId).HasName("PRIMARY");

            entity.ToTable("sys_role");

            entity.HasIndex(e => e.RoleName, "sys_role_uk").IsUnique();

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .HasComment("角色id")
                .HasColumnName("role_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Description)
                .HasMaxLength(500)
                .HasComment("描述")
                .HasColumnName("description");
            entity.Property(e => e.RoleName)
                .HasMaxLength(100)
                .HasComment("角色名")
                .HasColumnName("role_name");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<SysRoleModule>(entity =>
        {
            entity.HasKey(e => new { e.RoleId, e.ModuleId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_role_module");

            entity.HasIndex(e => e.ModuleId, "sys_rm_module_FK");

            entity.HasIndex(e => e.RoleId, "sys_rm_role_FK");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .HasColumnName("role_id");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
        });

        modelBuilder.Entity<SysRoleModuleAction>(entity =>
        {
            entity.HasKey(e => new { e.RoleId, e.ModuleId, e.ActionId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 });

            entity.ToTable("sys_role_module_action");

            entity.HasIndex(e => e.ActionId, "sys_role_module_action_sys_module_action_FK");

            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .HasColumnName("role_id");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
            entity.Property(e => e.ActionId)
                .HasMaxLength(64)
                .HasColumnName("action_id");
        });

        modelBuilder.Entity<SysSignLog>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_sign_log");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.Browser)
                .HasMaxLength(100)
                .HasColumnName("browser");
            entity.Property(e => e.Cellphone)
                .HasMaxLength(20)
                .HasColumnName("cellphone");
            entity.Property(e => e.Device)
                .HasMaxLength(100)
                .HasColumnName("device");
            entity.Property(e => e.IpAddress)
                .HasMaxLength(50)
                .HasColumnName("ip_address");
            entity.Property(e => e.LoginName)
                .HasMaxLength(50)
                .HasColumnName("login_name");
            entity.Property(e => e.NickName)
                .HasMaxLength(50)
                .HasColumnName("nick_name");
            entity.Property(e => e.Platform)
                .HasMaxLength(100)
                .HasColumnName("platform");
            entity.Property(e => e.SecEmail)
                .HasMaxLength(100)
                .HasColumnName("sec_email");
            entity.Property(e => e.SignOffTime)
                .HasColumnType("timestamp")
                .HasColumnName("sign_off_time");
            entity.Property(e => e.SignOnTime)
                .HasColumnType("timestamp")
                .HasColumnName("sign_on_time");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<SysTicket>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_ticket");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.Data)
                .HasMaxLength(512)
                .HasColumnName("data");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.IsVerified).HasColumnName("is_verified");
            entity.Property(e => e.TicketType)
                .HasMaxLength(20)
                .HasComment("票据类型 \r\n1 帐户激活\r\n2 找回密码")
                .HasColumnName("ticket_type");
        });

        modelBuilder.Entity<SysUser>(entity =>
        {
            entity.HasKey(e => e.UserId).HasName("PRIMARY");

            entity.ToTable("sys_user");

            entity.HasIndex(e => e.Cellphone, "sys_user_cellphone_uk").IsUnique();

            entity.HasIndex(e => e.LoginName, "sys_user_login_name_uk").IsUnique();

            entity.HasIndex(e => e.SecEmail, "sys_user_sec_email_uk").IsUnique();

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasComment("用户id")
                .HasColumnName("user_id");
            entity.Property(e => e.Cellphone)
                .HasMaxLength(20)
                .HasComment("手机号")
                .HasColumnName("cellphone");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.DisplayName)
                .HasMaxLength(50)
                .HasComment("用户显示名")
                .HasColumnName("display_name");
            entity.Property(e => e.LoginName)
                .HasMaxLength(50)
                .HasComment("账号名")
                .HasColumnName("login_name");
            entity.Property(e => e.SecEmail)
                .HasMaxLength(100)
                .HasComment("安全邮箱")
                .HasColumnName("sec_email");
            entity.Property(e => e.UpdateTime)
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
            entity.Property(e => e.UserStatus)
                .HasMaxLength(20)
                .HasDefaultValueSql("'Standard'")
                .HasComment("用户状态")
                .HasColumnName("user_status");
        });

        modelBuilder.Entity<SysUserConfig>(entity =>
        {
            entity.HasKey(e => e.UserId).HasName("PRIMARY");

            entity.ToTable("sys_user_config");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.ConfigData)
                .HasColumnType("json")
                .HasColumnName("config_data");
            entity.Property(e => e.Region)
                .HasMaxLength(20)
                .HasColumnName("region");
            entity.Property(e => e.TimeZone)
                .HasMaxLength(100)
                .HasColumnName("time_zone");
        });

        modelBuilder.Entity<SysUserDept>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.DeptPath })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_user_dept");

            entity.HasIndex(e => e.DeptPath, "sys_ud_dept_FK");

            entity.HasIndex(e => e.UserId, "sys_ud_user_FK");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.DeptPath)
                .HasMaxLength(512)
                .HasColumnName("dept_path");
        });

        modelBuilder.Entity<SysUserRole>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.RoleId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_user_role");

            entity.HasIndex(e => e.RoleId, "sys_ur_role_FK");

            entity.HasIndex(e => e.UserId, "sys_ur_user_FK");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.RoleId)
                .HasMaxLength(64)
                .HasColumnName("role_id");
        });

        modelBuilder.Entity<SysUserShortcut>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.ModuleId })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("sys_user_shortcut");

            entity.HasIndex(e => e.ModuleId, "sys_us_module_FK");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.ModuleId)
                .HasMaxLength(64)
                .HasColumnName("module_id");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<SysUserTicket>(entity =>
        {
            entity.HasKey(e => e.TicketId).HasName("PRIMARY");

            entity.ToTable("sys_user_ticket");

            entity.HasIndex(e => e.UserId, "sys_user_ticket_FK");

            entity.Property(e => e.TicketId)
                .HasMaxLength(64)
                .HasColumnName("ticket_id");
            entity.Property(e => e.CreateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("create_time");
            entity.Property(e => e.ExpireTime)
                .HasColumnType("timestamp")
                .HasColumnName("expire_time");
            entity.Property(e => e.IsVerified).HasColumnName("is_verified");
            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<UserWidget>(entity =>
        {
            entity.HasKey(e => new { e.UserId, e.WidgetName })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("user_widget");

            entity.HasIndex(e => e.WidgetName, "user_widget_widget_publish_FK");

            entity.Property(e => e.UserId)
                .HasMaxLength(64)
                .HasColumnName("user_id");
            entity.Property(e => e.WidgetName)
                .HasMaxLength(64)
                .HasColumnName("widget_name");
            entity.Property(e => e.Ordinal).HasColumnName("ordinal");
        });

        modelBuilder.Entity<VersionItem>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PRIMARY");

            entity.ToTable("version_item");

            entity.HasIndex(e => new { e.VersionSetName, e.RepoName }, "version_item_version_set_FK");

            entity.Property(e => e.Id).HasColumnName("id");
            entity.Property(e => e.AuthorId)
                .HasMaxLength(64)
                .HasColumnName("author_id");
            entity.Property(e => e.AuthorName)
                .HasMaxLength(50)
                .HasColumnName("author_name");
            entity.Property(e => e.Comment)
                .HasMaxLength(1024)
                .HasColumnName("comment");
            entity.Property(e => e.Content)
                .HasColumnType("json")
                .HasColumnName("content");
            entity.Property(e => e.Operation)
                .HasMaxLength(20)
                .HasColumnName("operation");
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .HasColumnName("repo_name");
            entity.Property(e => e.VersionSetName)
                .HasMaxLength(50)
                .HasColumnName("version_set_name");
            entity.Property(e => e.VersionTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("version_time");
        });

        modelBuilder.Entity<VersionSet>(entity =>
        {
            entity.HasKey(e => new { e.Name, e.RepoName })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable("version_set");

            entity.HasIndex(e => e.PubId, "version_set_publish_log_FK");

            entity.HasIndex(e => e.RepoName, "version_set_repository_set_FK");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .HasColumnName("repo_name");
            entity.Property(e => e.Description)
                .HasMaxLength(1000)
                .HasColumnName("description");
            entity.Property(e => e.PubId)
                .HasMaxLength(50)
                .HasColumnName("pub_id");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<WechatSent>(entity =>
        {
            entity.HasKey(e => e.MessageId).HasName("PRIMARY");

            entity.ToTable("wechat_sent");

            entity.Property(e => e.MessageId)
                .HasMaxLength(50)
                .HasColumnName("message_id");
            entity.Property(e => e.AccountName)
                .HasMaxLength(50)
                .HasColumnName("account_name");
            entity.Property(e => e.Body).HasColumnName("body");
            entity.Property(e => e.Data).HasColumnName("data");
            entity.Property(e => e.PictureUrl)
                .HasMaxLength(2048)
                .HasColumnName("picture_url");
            entity.Property(e => e.Receiver)
                .HasMaxLength(500)
                .HasColumnName("receiver");
            entity.Property(e => e.Response).HasColumnName("response");
            entity.Property(e => e.SendTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("send_time");
            entity.Property(e => e.TemplateName)
                .HasMaxLength(50)
                .HasColumnName("template_name");
            entity.Property(e => e.Title)
                .HasMaxLength(100)
                .HasColumnName("title");
            entity.Property(e => e.Url)
                .HasMaxLength(2048)
                .HasColumnName("url");
        });

        modelBuilder.Entity<WorkItem>(entity =>
        {
            entity.HasKey(e => new { e.Name, e.OwnerId, e.RepoName })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 });

            entity.ToTable("work_item");

            entity.HasIndex(e => e.RepoName, "work_item_repository_set_FK");

            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasColumnName("name");
            entity.Property(e => e.OwnerId)
                .HasMaxLength(64)
                .HasColumnName("owner_id");
            entity.Property(e => e.RepoName)
                .HasMaxLength(50)
                .HasColumnName("repo_name");
            entity.Property(e => e.Content)
                .HasColumnType("json")
                .HasColumnName("content");
            entity.Property(e => e.Description)
                .HasMaxLength(1000)
                .HasColumnName("description");
            entity.Property(e => e.OwnerName)
                .HasMaxLength(50)
                .HasColumnName("owner_name");
            entity.Property(e => e.Submitted).HasColumnName("submitted");
            entity.Property(e => e.UpdateTime)
                .HasDefaultValueSql("CURRENT_TIMESTAMP")
                .HasColumnType("timestamp")
                .HasColumnName("update_time");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
